"use client";

import { Card, Descriptions } from "antd";
import type { Course } from "@prisma/client";
import { CourseActions } from "./CourseActions";
import { CourseShareButton } from "./CourseShareButton";

interface CourseDetailProps {
  course: Course;
}

export function CourseDetail({ course }: CourseDetailProps) {
  return (
    <Card
      title="课程详情"
      extra={
        <div className="space-x-2">
          <CourseShareButton course={course} />
          <CourseActions courseId={course.id} />
        </div>
      }
    >
      <Descriptions column={1}>
        <Descriptions.Item label="课程名称">{course.title}</Descriptions.Item>
        <Descriptions.Item label="课程描述">{course.description}</Descriptions.Item>
        <Descriptions.Item label="课程目标">{course.objectives}</Descriptions.Item>
        <Descriptions.Item label="先修要求">{course.prerequisites}</Descriptions.Item>
        <Descriptions.Item label="状态">
          {course.status === "DRAFT" ? "草稿" : "已发布"}
        </Descriptions.Item>
      </Descriptions>
    </Card>
  );
}